import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useMenuStore = defineStore({
  id: 'menu',
  state: () => {
    return {
      openMenu: [],
      menuIdx: 0,
      menuRoute: []
    }
  },
  getters: {},
  actions: {},
  // 开启数据缓存
  persist: {
    enabled: true,
    strategies: [{
      key: 'my_project',
      storage: sessionStorage,
    }]
  }
})

export const useStateStore = defineStore('state', () => {
  const info = ref(false)
  const cer = ref(false)
  const per = ref(false)
  const api = ref(false)
  const code = ref(true)
  const manifest_path = ref('')
  const dex_output_dir = ref('')

  const changeInfo = () => {
    info.value = true
  }
  const changeCer = () => {
    cer.value = true
  }
  const changePer = () => {
    per.value = true
  }
  const changeAPI = () => {
    api.value = true
  }
  const changeCode = () => {
    code.value = true
  }
  return {
    info,
    cer,
    per,
    api,
    code,
    changeAPI,
    changeCer,
    changeCode,
    changeInfo,
    changePer,
    manifest_path,
    dex_output_dir
  }
})

export const useReportStore = defineStore('report',()=>{
  const basicReport = ref({})
  const cerReport = ref({})

  const changeBasicReport=(val)=>{
    basicReport.value = val
    console.log(basicReport.value)
  }
  const changeCerReport=(val)=>{
    cerReport.value = val
  }
  return{
    basicReport,
    cerReport,
    changeCerReport,
    changeBasicReport,
  }
})